package ru.evga.inse.server.gwt.user.client.menu.admin;

import ru.evga.inse.server.gwt.user.client.IUserAppFactory;

import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;


public class AdminActivity
    extends AbstractActivity
    implements ru.evga.inse.server.gwt.user.client.menu.admin.AdminView.Presenter
{
    
    private IUserAppFactory m_factory;
    
    
    public AdminActivity(IUserAppFactory factory)
    {
        m_factory = factory;
    }
    
    public void start(AcceptsOneWidget panel, EventBus eventBus)
    {
        AdminView view = m_factory.getMenuFactory().getAdminItemView();
        view.setPresenter(this);
        panel.setWidget(view.asWidget());
    }

    public void goToCity()
    {
        m_factory.getPlaceController().goTo(AdminPlaceParamUtil.buildListEntityPlace(Entities.CITY).build());
    }
    
    public void goToStreet()
    {
        m_factory.getPlaceController().goTo(AdminPlaceParamUtil.buildListEntityPlace(Entities.STREET).build());
    }
}
